package net.luoran.dvm.entity;

import lombok.Data;
import net.luoran.dvm.common.base.BaseEntity;

/**
 * @author ：M1nG
 * @date ：Created in 2020/11/11 22:08
 * @description：
 * @version: 1.0
 */
@Data
public class AuthInfo extends BaseEntity {

    private Integer id;

    private String expireTime;


    public AuthInfo() {

    }

    public AuthInfo(Integer id, String expireTime, String accountGroupId) {
        this.id = id;
        this.expireTime = expireTime;
        this.accountGroupId = accountGroupId;
    }

    public AuthInfo init(String str) {
        AuthInfo authInfo;
        String[] split = str.split("-");
        try {
            authInfo = new AuthInfo(Integer.valueOf(split[0]), split[1], split[2]);
        } catch (NumberFormatException e) {
            return null;
        }
        return authInfo;
    }

    public String toStr() {
        return id + "-" + expireTime + "-" + accountGroupId;
    }
}
